package leetcode.linkedlist;

import leetcode.linkedlist.common.LinkedListUtils;
import leetcode.linkedlist.common.ListNode;

/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode() {}
 *     ListNode(int val) { this.val = val; }
 *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution25 {
    public ListNode reverseKGroup(ListNode head, int k) {
        return LinkedListUtils.reverseKGroup(head, k);
    }
}

public class leetcode25 {
    public static void main(String[] args) {
        Solution25 solution25 = new Solution25();
        int[] nums = {1,2,3,4,5};
        int[] nums1 = {1,2,3,4,5,6};
//        test25(solution25, nums, 1);
//        test25(solution25, nums, 2);
//        test25(solution25, nums, 3);
//        test25(solution25, nums, 4);
//        test25(solution25, nums, 5);


//        test25(solution25, nums1, 1);
        test25(solution25, nums1, 2);
//        test25(solution25, nums1, 3);
//        test25(solution25, nums1, 4);
//        test25(solution25, nums1, 5);
    }

    private static void test25(Solution25 solution25, int[] nums, int k) {
        ListNode head = solution25.reverseKGroup(LinkedListUtils.generateLinkedListByArray(nums), k);
        System.out.println(LinkedListUtils.getLinkedListVals(head));
    }

}
